package com.gpscookie.mgateway;

import java.util.Properties;

import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.NoSuchProviderException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;

import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

public class SMSBroadcastReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context arg0, Intent arg1) {
		// TODO Auto-generated method stub
		
	}
	
	public static void sendEmail() throws MessagingException {
		Properties props = new Properties();
		props.setProperty("mail.transport.protocol", "smtp");
		props.setProperty("mail.host", "smtp.163.com");
		props.setProperty("mail.user", "reachlin");
		props.setProperty("mail.password", "gpscookie");
		
		Session mailSession = Session.getDefaultInstance(props, null);
		Transport transport = mailSession.getTransport();
		
		MimeMessage message = new MimeMessage(mailSession);
		message.setSubject("Testing javamail plain");
		message.setContent("This is a test", "text/plain");
		message.addRecipient(Message.RecipientType.TO,
		     new InternetAddress("reachlin@gmail.com"));
		
		transport.connect();
		transport.sendMessage(message,
		        message.getRecipients(Message.RecipientType.TO));
		    transport.close();
	}

}